package com.chb.dao;

import com.chb.model.entity.Branch;
import com.chb.model.entity.Role;
import com.chb.model.entity.Staff;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 陈海彬
 * @date: Created in 2023/9/26 17:45
 * @description: 分店dao层
 * @modified By:
 * @version: 1.0
 */
public interface BranchDao {

    /**
     * 查询所有分店信息
     *
     * @param branchid 分店id
     * @return
     */
    public List<Branch> findAllBranch(@Param("branchid") Integer branchid, @Param("staffid") Integer staffid);


    /**
     * @param
     * @return
     * @create by: 张77
     * @description:模糊查詢方法
     * @create time: 2023/9/26 21:26
     */
    public List<Branch> findAll(Integer staffid);

    /**
     * @param
     * @param branchid 分店id
     * @param staffid  员工id
     * @return
     * @create by: xIAO_ZHOU
     * @description: 查询所有店铺信息（店长、开店时间...）以及该店员工人数
     * @create time: 2023/9/30 22:05
     */
    public List<Branch> selectAllBranchAndStaff(Branch branch);

    /**
     * 获取平调分店下拉框信息
     *
     * @param branchid 分店id
     * @return
     */
    List<Branch> flatInformation(Integer branchid);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 根据店铺名称模糊查询店铺信息
     * @create time: 2023/10/4 20:27
     */
    List<Branch> queryBranchInfoBybranchname(Branch branchname);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 添加新的店铺及信息
     * @create time: 2023/10/5 19:56
     */
    Integer insertNewBranch(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 通过店铺id 进行修改店铺信息
     * @create time: 2023/10/5 20:35
     */
    Integer updateBranch(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 通过店铺id 进行修改店铺状态（营业/整顿）
     * @create time: 2023/10/8 11:23
     */
    Integer adjustBranch(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 通过店铺id 删除店铺信息
     * @create time: 2023/10/8 15:08
     */
    Integer delBranch(Branch branch);
    /**
     * @create by: xIAO_ZHOU
     * @description: 查询所删除的店铺是否存在商品
     * @create time: 2023/10/13 10:58
     * @param
     * @return 
     */
    List<Branch> queryProduct(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 查询在职且没有安排岗位的员工（可以安排为店长的员工）
     * @create time: 2023/10/8 15:51
     */
    List<Staff> selectNoArrangementBranch();

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 确定员工为新店的店长后，将该员工之前的branchid 修改为新店的branchid
     * @create time: 2023/10/9 11:19
     */
    Integer changeBranchid(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 给店铺添加上店长的staffid
     * @create time: 2023/10/9 15:46
     */
    Integer updateStaffidforBranch(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 确定员工为新店的店长后，将该员工之前的roleid 修改为店长的roleid
     * @create time: 2023/10/9 19:15
     */
    Integer changeRoleid(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 根据员工的staffid 查询roleid 再查询rolename
     * @create time: 2023/10/9 19:39
     */
    List<Role> selectRoleNameByStaffid(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 加载店长调离框中所有职位信息
     * @create time: 2023/10/9 20:44
     */
    List<Role> selectAllRoleName();

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 加载店长调离框中所有店名
     * @create time: 2023/10/9 20:44
     */
    public List<Branch> selectAllBranchName();

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 调离后将原来店铺的店长staffid改为 null
     * @create time: 2023/10/10 11:20
     */
    public Integer changeManagerStaffid(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 调离后将原来店铺的店长branchid改为 新店的branchid
     * @create time: 2023/10/10 11:41
     */
    public Integer changeManagerBranchid(Branch branch);

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 调离后将原来店铺的店长Deptid改为 新店的Deptid
     * @create time: 2023/10/10 11:42
     */
    public Integer changeManagerRoleid(Branch branch);

}

